using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Deepcode.Flux.Core.Services.State;
using Example.Workflow.Objects;

public partial class extensions_exampleworkflow_manage_showApproved : Deepcode.Flux.Core.UI.AdministrationModulePage
{
	#region Page Load event
	/// <summary>
	/// Page Load event
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!Page.IsPostBack)
		{
			BindDataGrid();
		}
	}
	#endregion
	#region Initialisation
	/// <summary>
	/// OnInit - hooks up the data paging handler, 
	/// rpp change handler and item command handlers
	/// </summary>
	/// <param name="e"></param>
	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);
		datapager.OnRepage += new Deepcode.Flux.Core.UI.Controls.DataPager.PagerRepage(BindDataGrid);
		datapager.OnRPPChanged += new Deepcode.Flux.Core.UI.Controls.DataPager.RPPChanged(RowsPerPageChange);
	}
	#endregion
	#region Data binding and paging events
	/// <summary>
	/// Data binding
	/// </summary>
	private void BindDataGrid()
	{
		// Set rows per page from registry
		datapager.RowsPerPage = this.UserSetting("RowsPerPage", 10);

		// Get and bind the data
		TelephoneBook book = new TelephoneBook();
		datapager.DataSource = book.GetApprovedTelephoneBook();
		datapager.DataBind();
	}
	/// <summary>
	/// Paging control has set a new number of rows per page - store in user registry
	/// </summary>
	/// <param name="NewRPP"></param>
	void RowsPerPageChange(int NewRPP)
	{
		this.SetUserSetting("RowsPerPage", NewRPP);
	}
	#endregion
}
